#ifndef __capture_h
#define __capture_h 1
#include "sys.h"
#include "log.h"
#include "net.h"
#include "pcap_output.h"
#include "packet.h"
#include "hook.h"
#include "thread_pool.h"
#include "net_stack.h"

enum {
    CAPTURE_SYNC = 0,
    CAPTURE_ASYN = 1,
};


typedef struct _capture {
    int raw_fd;
    int asyn;
    uint32_t total_len;
    struct hook* list;
    thread_pool_t* tp;
} Capture_t;

extern Capture_t* capture_new();
extern int capture_set_thread_pool(Capture_t* cap, int num, int flag, int max);
extern int capture_set_asyn(Capture_t* cap, int asyn);
extern int capture_run(Capture_t* cap);
extern void capture_free(Capture_t* cap);
extern int capture_set_promisc(Capture_t* cap, char* ifName);
extern int capture_bind(Capture_t* cap, char* ifName);
extern int capture_get_fd(Capture_t* cap);
#endif